@extends('app.base')

@section('page_title')
  部落
@endsection

@section('page_header')
  <link rel="stylesheet" type="text/css" href="/bower_components/fancybox/dist/jquery.fancybox.min.css">
  <style>
body {
  background:url('/images/index-bg.png') no-repeat fixed;background-size:100% 100%;
  height:100%;}
  </style>
@endsection

@section('content')
  <div class="luo-index-wrapper">
    <div class="logo" style="padding-top:80px;"><img src="/images/logo.png" /></div>  
    <div class="luo-list">
      @foreach ($luo_list as $luo)
        <div class="luo">
          <a href="/luo/{{ $luo->id }}">
            <img src="{{ $luo->pic }}" />
            @php
              $user = null;
              if($is_login){
                $user = \App\Models\User::findOrFail(session('app_uid'));
              }
            @endphp
            @if ($user && $user->get_luo() && $user->get_luo()->id == $luo->id)
              <span class="red">我的部落</span>
            @else
              <span>{{ $luo->name }}</span>
            @endif
          </a>
        </div>
      @endforeach
    </div>
  </div>
@endsection

@section('page_script')
  <script src="/bower_components/fancybox/dist/jquery.fancybox.min.js"></script>
  <script>
$(function(){
  function is_mobile() {
    return navigator.userAgent.match(/(Android|iPhone)/);
  }
  if(window.parent.location.pathname != '/pc' && !is_mobile()) window.location = '/pc';
  @if (session('error'))
    $.fancybox.open('<div class="message"><h2>警告!</h2><p>{{ session('error') }}</p></div>');
  @endif
})
  </script>
@endsection
